package com.spring.shops.model.result;

import com.spring.shops.model.entity.TzHotSearch;
import com.spring.shops.model.vo.PageVo;
import lombok.Data;

//统一响应体
@Data
public class HotSearchResult {
    private String code=null;
    private String msg=null;
    private Object data;
    private String version="";
    private Integer timestamp=null;
    private String sign=null;
    private boolean success=true;
    private boolean fail=true;

    /**
     * 返回热销商品查询的结果
     * @param
     * @return
     */
    public static HotSearchResult HotSearchSuccess(){
        HotSearchResult result=new HotSearchResult();
        result.setData(null);
        result.setMsg("ok");
        result.setVersion("mall4j.v230424");
        result.setFail(false);
        return result;
    }

    /**
     * 返回热销商品删除的结果
     * @return
     */
    public static HotSearchResult HotSuccess() {
        HotSearchResult result = new HotSearchResult();
        result.setMsg("ok");
        result.setVersion("mall4j.v230424");
        result.setFail(false);
        result.setCode("00000");
        return result;
    }
    public static HotSearchResult infoResult(TzHotSearch tzHotSearch) {
        HotSearchResult result = new HotSearchResult();
        result.setVersion("mall4j.v230424");
        result.setFail(false);
        result.setCode("00000");
        result.setData(tzHotSearch);
        return result;
    }
    public static HotSearchResult PageResult(PageVo pageVo1){
        HotSearchResult result = new HotSearchResult();
        PageVo pageVo=new PageVo();
        pageVo.setRecords(pageVo1.getRecords());
        pageVo.setTotal(pageVo1.getTotal());
        pageVo.setSize(pageVo1.getSize());
        pageVo.setCurrent(pageVo1.getCurrent());
        result.setData(pageVo);
        result.setFail(false);
        result.setVersion("mall4j.v230424");
        result.setCode("00000");
        return result;
    }
}
